// pages/tabBar/mine/components/service.js
// import {
//   getInfo as mchGetInfo
// } from '/api/enterprise'
import {getInfo as mchGetInfo} from "../../../../api/enterprise"
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    
  },

  /**
   * 组件的初始数据
   */
  data: {
    mch: null,
    phone:4000594517,
  },

  /**
   * 组件的方法列表
   */
  attached(){
    this.getInfoClick()
  },
  methods: {
    PhoneClick(){
      var _this = this
      if (_this.data.mch.phone) {
        wx.makePhoneCall({
          phoneNumber: _this.data.mch.phone // 仅为示例，并非真实的电话号码
        })
      }else{
        wx.showToast({
          title: '暂无客服电话',
        })
      }
    },
    // bAppClick(){
    //   wx.navigateTo({
    //     url: '/pages/member/webview/index',
    //   })
    // },

    EnterClick(){
      wx.navigateTo({
        url: '/pages/tabBar/mine/enter',
      })
    },
    loginClick(){
      wx.navigateTo({
        url: '/pages/login/index',
      })
    },
    getInfoClick() {
      let _this = this
      console.info("我被执行了")
      mchGetInfo({ "mchId": app.globalData.mchId }).then(
        res => {
          console.log(res)
          if (res.type == 'success') {
            _this.data.mch = res.data
            _this.setData({
              mch: _this.data.mch
            })
          }
        }
      ).catch(error => {
        console.log(error)
      })
    },
  }
})
